
@rem Description: guestAgent prebuild script, Platform:ARM64
@echo off

set CURRENT_DIR=%cd%
set TOP=%CURRENT_DIR%\..\..
set OPENSOURCE=%TOP%\open_source

if not exist %OPENSOURCE% (
    echo "mkdir opensource ......"
    mkdir %OPENSOURCE%
)

cd %OPENSOURCE%

if not exist protobuf (
    echo "Download protobuf ......"
    git clone -b v4.25.2 https://github.com/protocolbuffers/protobuf.git
    cd protobuf\third_party
    git clone -b 20230802.3 https://github.com/abseil/abseil-cpp.git
    cd %OPENSOURCE%
    xcopy /Y /E /S protobuf\ protobuf_x64\
) else (
    echo "Protobuf has been existed."
)
if not exist spdlog (
    echo "Download spdlog ......"
    git clone -b v1.12.0 https://github.com/gabime/spdlog.git
) else (
    echo "Spdlog has been existed."
)
if not exist Detours (
    echo "Download Detours ......"
    git clone -b main https://github.com/microsoft/Detours.git
) else (
    echo "Detours has been existed."
)

if not exist cJSON (
    echo "Download cJSON ......"
    git clone -b v1.7.18 https://github.com/DaveGamble/cJSON.git
) else (
    echo "cJSON exists"
)
cd %TOP%